.phony:

upload.%:%
	ant upload.$<

c: changes/index.php
uc: upload.static

changes/index.php: ./script/convert_changes CHANGES.txt
	mkdir -p `dirname $@`
	chmod +x $<
	./$^ > $@

stats.php: gen_stats
	chmod +x $<
	./$^ > $@

upload.static: changes/*.php about/*.php stats.php states.php
	ant $@

upload.php: changes/index.php stats.php
	ant $@

upload.xml: changes/index.php stats.php
	ant $@

upload.simple: changes/index.php stats.php
	ant $@


test: test-ruby
test-ruby:
	@for f in test/tc_*.rb; do\
		chmod +x $$f;\
		ruby -w ./$$f;\
	done

config.sample: config.php Makefile
	cat $< | sed -e 's/,.*/,"TODO"\);/g' > $@

clean:
	rm -f *~ config.sample changes/index.php stats.php

allclean: clean